Version:0.9 StartHTML:0000000105 EndHTML:0000022950
StartFragment:0000000152 EndFragment:0000022916 #include <stdio.h>
#include <stdlib.h>
main()
{
int choice;
while(1)
{
printf("\nRatio Calc for Linux");
printf("\n====================");
printf("\n1.) Schedule 40 Pipe");
printf("\n2.) Schedule 80 Pipe");
printf("\n3.) Schedule 120 Pipe");
printf("\n4.) Exit");
printf("\n\nYour Choice-->");
scanf("%d",&choice);
if(choice==1)
{
sch40();
}
else if(choice==2)
{
sch80();
}
else if(choice==3)
{
sch120();
}
else if(choice==4)
{
printf("\nThank You for using Ratio Calc for Linux");
exit(0);
}
}
}
sch40()
{
float l,w,r,rr,d,v40,sch40[22];
sch40[0]=0.261;sch40[1]=0.354;sch40[2]=0.483;sch40[3]=0.608;
sch40[4]=0.810;sch40[5]=1.033;sch40[6]=1.364;sch40[7]=1.592;
sch40[8]=2.049;sch40[9]=2.445;sch40[10]=3.042;sch40[11]=3.520;
sch40[12]=3.998;sch40[13]=5.017;sch40[14]=6.301;sch40[15]=7.943;
sch40[16]=9.976;sch40[17]=11.890;sch40[18]=13.072;sch40[19]=14.940;
sch40[20]=16.809;sch40[21]=18.743;sch40[22]=22.544;
printf("\n\nSchedule 40 PVC");
printf("\nEnter Nominal Pipe Width (in inches)");
printf("\n-->");
scanf("%f",&w);
printf("\nEnter Pipe Length (in inches)");
printf("\n-->");
scanf("%f",&l);
if(w==0.125)
d=sch40[0];
else if(w==0.25)
d=sch40[1];
else if(w==0.375)
d=sch40[2];
else if(w==0.50)
d=sch40[3];
else if(w==0.75)
d=sch40[4];
else if(w==1)
d=sch40[5];
else if(w==1.25)
d=sch40[6];
else if(w==1.5)
d=sch40[7];
else if(w==2)
d=sch40[8];
else if(w==2.5)
d=sch40[9];
else if(w==3)
d=sch40[10];
else if(w==3.5)
d=sch40[11];
else if(w==4)
d=sch40[12];
else if(w==5)
d=sch40[13];
else if(w==6)
d=sch40[14];
else if(w==8)
d=sch40[15];
else if(w==10)
d=sch40[16];
else if(w==12)
d=sch40[17];
else if(w==14)
d=sch40[18];
else if(w==16)
d=sch40[19];
else if(w==18)
d=sch40[20];
else if(w==20)
d=sch40[21];
else if(w==24)
d=sch40[22];
else
printf("\nInvalid Input");
r=d/2;
rr=r*r;
v40=l*3.141592654*rr;
printf("\nVolume for Chamber is %f\n\n",v40);
}
sch80()
{
float l,w,r,rr,d,v80,sch80[22];
sch80[0]=0.203;sch80[1]=0.288;sch80[2]=0.407;sch80[3]=0.528;
sch80[4]=0.724;sch80[5]=0.935;sch80[6]=1.256;sch80[7]=1.476;
sch80[8]=1.913;sch80[9]=2.289;sch80[10]=2.864;sch80[11]=3.326;
sch80[12]=3.786;sch80[13]=4.767;sch80[14]=5.709;sch80[15]=7.565;
sch80[16]=9.492;sch80[17]=11.294;sch80[18]=12.410;sch80[19]=14.214;
sch80[20]=16.014;sch80[21]=17.814;sch80[22]=21.418;
printf("\n\nSchedule 80 PVC");
printf("\nEnter Nominal Pipe Width (in inches)");
printf("\n-->");
scanf("%f",&w);
printf("\nEnter Pipe Length (in inches)");
printf("\n-->");
scanf("%f",&l);
if(w==0.125)
d=sch80[0];
else if(w==0.25)
d=sch80[1];
else if(w==0.375)
d=sch80[2];
else if(w==0.50)
d=sch80[3];
else if(w==0.75)
d=sch80[4];
else if(w==1)
d=sch80[5];
else if(w==1.25)
d=sch80[6];
else if(w==1.5)
d=sch80[7];
else if(w==2)
d=sch80[8];
else if(w==2.5)
d=sch80[9];
else if(w==3)
d=sch80[10];
else if(w==3.5)
d=sch80[11];
else if(w==4)
d=sch80[12];
else if(w==5)
d=sch80[13];
else if(w==6)
d=sch80[14];
else if(w==8)
d=sch80[15];
else if(w==10)
d=sch80[16];
else if(w==12)
d=sch80[17];
else if(w==14)
d=sch80[18];
else if(w==16)
d=sch80[19];
else if(w==18)
d=sch80[20];
else if(w==20)
d=sch80[21];
else if(w==24)
d=sch80[22];
else
printf("\nInvalid Input");
r=d/2;
rr=r*r;
v80=l*3.141592654*rr;
printf("\nVolume for Chamber is %f\n\n",v80);
}
sch120()
{
float l,w,d,r,rr,v120,sch120[9];
sch120[0]=0.480;sch120[1]=0.690;sch120[2]=0.891;
sch120[3]=1.204;sch120[4]=1.423;sch120[5]=1.845;
sch120[6]=2.239;sch120[7]=2.758;sch120[8]=3.572;
sch120[9]=5.424;
printf("\n\nSchedule 120 PVC");
printf("\nEnter Nominal Pipe Width (in inches)");
printf("\n-->");
scanf("%f",&w);
printf("\nEnter Pipe Length (in inches)");
printf("\n-->");
scanf("%f",&l);
if(w==0.50)
d=sch120[0];
else if(w==0.75)
d=sch120[1];
else if(w==1)
d=sch120[2];
else if(w==1.25)
d=sch120[3];
else if(w==1.50)
d=sch120[4];
else if(w==2)
d=sch120[5];
else if(w==2.50)
d=sch120[6];
else if(w==3)
d=sch120[7];
else if(w==4)
d=sch120[8];
else if(w==6)
d=sch120[9];
else
printf("\nInvalid Input");
r=d/2;
rr=r*r;
v120=l*3.141592654*rr;
printf("\nVolume for Chamber is %f\n\n",v120);
}